﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using JSistemas.JBImg.Properties;

namespace WindowsFormsApplication9
{
    public partial class ConfiguracaoProxyTela : Form
    {
        public ConfiguracaoProxyTela()
        {
            InitializeComponent();
        }

        private void HabilitarInputs(Boolean habilitar = true)
        {
            if (this.IsDisposed) { return; }

            this.HostInput.Enabled = habilitar;
            this.PortaInput.Enabled = habilitar;
            this.UsuarioInput.Enabled = habilitar;
            this.SenhaInput.Enabled = habilitar;            
        }

        private void GravarBotao_Click(object sender, EventArgs e)
        {
            Settings.Default.UsarProxy = this.UsarProxyInput.Checked;
            Settings.Default.ProxyHost = this.HostInput.Text;
            Settings.Default.ProxyPorta = this.PortaInput.Text;
            Settings.Default.ProxyUsuario = this.UsuarioInput.Text;
            Settings.Default.ProxySenha = this.SenhaInput.Text;
            Settings.Default.Configurado = true;
            Settings.Default.Save();
        }

        private void UsarProxyInput_CheckedChanged(object sender, EventArgs e)
        {
            this.HabilitarInputs(this.UsarProxyInput.Checked);
        }
    }
}
